home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / QuickTime / QuickTime 3 Interfaces & Libs / QTDevMac / CIncludes / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-21  |  14.7 KB  |  515 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DDrawContext.h
  3.  
  4.      Contains:    Draw context class types and routines                               
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    QuickTime 3.0
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __QD3DDRAWCONTEXT__
  19. #define __QD3DDRAWCONTEXT__
  20.  
  21. #ifndef __QD3D__
  22. #include <QD3D.h>
  23. #endif
  24.  
  25. #if TARGET_OS_MAC
  26. #ifndef __QUICKDRAW__
  27. #include <Quickdraw.h>
  28. #endif
  29. #ifndef __FIXMATH__
  30. #include <FixMath.h>
  31. #endif
  32. #ifndef __GXTYPES__
  33. #include <GXTypes.h>
  34. #endif
  35. #endif  /* TARGET_OS_MAC */
  36.  
  37.  
  38. #if TARGET_OS_UNIX
  39.     #include <X11/Xlib.h>
  40.     #include <X11/Xutil.h>
  41. #endif    /* TARGET_OS_WIN32 */
  42.  
  43.  
  44. #if TARGET_OS_WIN32
  45.     /******************************************************************************
  46.      *                                                                             **
  47.      * ABOUT   QD3D_NO_DIRECTDRAW:     (Win32 Only)                                 **
  48.      *                                                                             **
  49.      * NOTE: Define QD3D_NO_DIRECTDRAW for your application makefile/project     **
  50.      *       only if you don't need Q3DDSurfaceDrawContext support and don't     **
  51.      *       have access to ddraw.h.                                             ** 
  52.      *                                                                             **
  53.      *****************************************************************************/
  54.     #include <windows.h>
  55.     #if !defined(QD3D_NO_DIRECTDRAW)
  56.         #include <ddraw.h>
  57.     #endif /* !QD3D_NO_DIRECTDRAW */
  58. #endif  /*  TARGET_OS_WIN32  */
  59.  
  60.  
  61.  
  62. #if PRAGMA_ONCE
  63. #pragma once
  64. #endif
  65.  
  66. #ifdef __cplusplus
  67. extern "C" {
  68. #endif
  69.  
  70. #if PRAGMA_IMPORT
  71. #pragma import on
  72. #endif
  73.  
  74. #if PRAGMA_STRUCT_ALIGN
  75.     #pragma options align=power
  76. #elif PRAGMA_STRUCT_PACKPUSH
  77.     #pragma pack(push, 2)
  78. #elif PRAGMA_STRUCT_PACK
  79.     #pragma pack(2)
  80. #endif
  81.  
  82. #if PRAGMA_ENUM_ALWAYSINT
  83.     #pragma enumsalwaysint on
  84. #elif PRAGMA_ENUM_OPTIONS
  85.     #pragma option enum=int
  86. #elif PRAGMA_ENUM_PACK
  87.     #if __option(pack_enums)
  88.         #define PRAGMA_ENUM_PACK__QD3DDRAWCONTEXT__
  89.     #endif
  90.     #pragma options(!pack_enums)
  91. #endif
  92.  
  93. /******************************************************************************
  94.  **                                                                             **
  95.  **                            DrawContext Data Structures                         **
  96.  **                                                                             **
  97.  *****************************************************************************/
  98.  
  99. enum TQ3DrawContextClearImageMethod {
  100.     kQ3ClearMethodNone            = 0,
  101.     kQ3ClearMethodWithColor        = 1
  102. };
  103. typedef enum TQ3DrawContextClearImageMethod TQ3DrawContextClearImageMethod;
  104.  
  105.  
  106.  
  107. struct TQ3DrawContextData {
  108.     TQ3DrawContextClearImageMethod     clearImageMethod;
  109.     TQ3ColorARGB                     clearImageColor;
  110.     TQ3Area                         pane;
  111.     TQ3Boolean                         paneState;
  112.     TQ3Bitmap                         mask;
  113.     TQ3Boolean                         maskState;
  114.     TQ3Boolean                         doubleBufferState;
  115. };
  116. typedef struct TQ3DrawContextData        TQ3DrawContextData;
  117. /******************************************************************************
  118.  **                                                                             **
  119.  **                                DrawContext Routines                         **
  120.  **                                                                             **
  121.  *****************************************************************************/
  122. EXTERN_API_C( TQ3ObjectType )
  123. Q3DrawContext_GetType            (TQ3DrawContextObject     drawContext);
  124.  
  125. EXTERN_API_C( TQ3Status )
  126. Q3DrawContext_SetData            (TQ3DrawContextObject     context,
  127.                                  const TQ3DrawContextData * contextData);
  128.  
  129. EXTERN_API_C( TQ3Status )
  130. Q3DrawContext_GetData            (TQ3DrawContextObject     context,
  131.                                  TQ3DrawContextData *    contextData);
  132.  
  133. EXTERN_API_C( TQ3Status )
  134. Q3DrawContext_SetClearImageColor (TQ3DrawContextObject     context,
  135.                                  const TQ3ColorARGB *    color);
  136.  
  137. EXTERN_API_C( TQ3Status )
  138. Q3DrawContext_GetClearImageColor (TQ3DrawContextObject     context,
  139.                                  TQ3ColorARGB *            color);
  140.  
  141. EXTERN_API_C( TQ3Status )
  142. Q3DrawContext_SetPane            (TQ3DrawContextObject     context,
  143.                                  const TQ3Area *        pane);
  144.  
  145. EXTERN_API_C( TQ3Status )
  146. Q3DrawContext_GetPane            (TQ3DrawContextObject     context,
  147.                                  TQ3Area *                pane);
  148.  
  149. EXTERN_API_C( TQ3Status )
  150. Q3DrawContext_SetPaneState        (TQ3DrawContextObject     context,
  151.                                  TQ3Boolean             state);
  152.  
  153. EXTERN_API_C( TQ3Status )
  154. Q3DrawContext_GetPaneState        (TQ3DrawContextObject     context,
  155.                                  TQ3Boolean *            state);
  156.  
  157. EXTERN_API_C( TQ3Status )
  158. Q3DrawContext_SetClearImageMethod (TQ3DrawContextObject  context,
  159.                                  TQ3DrawContextClearImageMethod  method);
  160.  
  161. EXTERN_API_C( TQ3Status )
  162. Q3DrawContext_GetClearImageMethod (TQ3DrawContextObject  context,
  163.                                  TQ3DrawContextClearImageMethod * method);
  164.  
  165. EXTERN_API_C( TQ3Status )
  166. Q3DrawContext_SetMask            (TQ3DrawContextObject     context,
  167.                                  const TQ3Bitmap *        mask);
  168.  
  169. EXTERN_API_C( TQ3Status )
  170. Q3DrawContext_GetMask            (TQ3DrawContextObject     context,
  171.                                  TQ3Bitmap *            mask);
  172.  
  173. EXTERN_API_C( TQ3Status )
  174. Q3DrawContext_SetMaskState        (TQ3DrawContextObject     context,
  175.                                  TQ3Boolean             state);
  176.  
  177. EXTERN_API_C( TQ3Status )
  178. Q3DrawContext_GetMaskState        (TQ3DrawContextObject     context,
  179.                                  TQ3Boolean *            state);
  180.  
  181. EXTERN_API_C( TQ3Status )
  182. Q3DrawContext_SetDoubleBufferState (TQ3DrawContextObject  context,
  183.                                  TQ3Boolean             state);
  184.  
  185. EXTERN_API_C( TQ3Status )
  186. Q3DrawContext_GetDoubleBufferState (TQ3DrawContextObject  context,
  187.                                  TQ3Boolean *            state);
  188.  
  189.  
  190. /******************************************************************************
  191.  **                                                                             **
  192.  **                            Pixmap Data Structure                             **
  193.  **                                                                             **
  194.  *****************************************************************************/
  195.  
  196. struct TQ3PixmapDrawContextData {
  197.     TQ3DrawContextData                 drawContextData;
  198.     TQ3Pixmap                         pixmap;
  199. };
  200. typedef struct TQ3PixmapDrawContextData    TQ3PixmapDrawContextData;
  201. /******************************************************************************
  202.  **                                                                             **
  203.  **                        Pixmap DrawContext Routines                             **
  204.  **                                                                             **
  205.  *****************************************************************************/
  206. EXTERN_API_C( TQ3DrawContextObject )
  207. Q3PixmapDrawContext_New            (const TQ3PixmapDrawContextData * contextData);
  208.  
  209. EXTERN_API_C( TQ3Status )
  210. Q3PixmapDrawContext_SetPixmap    (TQ3DrawContextObject     drawContext,
  211.                                  const TQ3Pixmap *        pixmap);
  212.  
  213. EXTERN_API_C( TQ3Status )
  214. Q3PixmapDrawContext_GetPixmap    (TQ3DrawContextObject     drawContext,
  215.                                  TQ3Pixmap *            pixmap);
  216.  
  217.  
  218.  
  219. #if TARGET_OS_MAC
  220. /******************************************************************************
  221.  **                                                                             **
  222.  **                        Macintosh DrawContext Data Structures                 **
  223.  **                                                                             **
  224.  *****************************************************************************/
  225.  
  226. enum TQ3MacDrawContext2DLibrary {
  227.     kQ3Mac2DLibraryNone            = 0,
  228.     kQ3Mac2DLibraryQuickDraw    = 1,
  229.     kQ3Mac2DLibraryQuickDrawGX    = 2
  230. };
  231. typedef enum TQ3MacDrawContext2DLibrary TQ3MacDrawContext2DLibrary;
  232.  
  233.  
  234.  
  235. struct TQ3MacDrawContextData {
  236.     TQ3DrawContextData                 drawContextData;
  237.     CWindowPtr                         window;
  238.     TQ3MacDrawContext2DLibrary         library;
  239.     gxViewPort                         viewPort;
  240.     CGrafPtr                         grafPort;
  241. };
  242. typedef struct TQ3MacDrawContextData    TQ3MacDrawContextData;
  243. /******************************************************************************
  244.  **                                                                             **
  245.  **                        Macintosh DrawContext Routines                         **
  246.  **                                                                             **
  247.  *****************************************************************************/
  248. EXTERN_API_C( TQ3DrawContextObject )
  249. Q3MacDrawContext_New            (const TQ3MacDrawContextData * drawContextData);
  250.  
  251. EXTERN_API_C( TQ3Status )
  252. Q3MacDrawContext_SetWindow        (TQ3DrawContextObject     drawContext,
  253.                                  CWindowPtr             window);
  254.  
  255. EXTERN_API_C( TQ3Status )
  256. Q3MacDrawContext_GetWindow        (TQ3DrawContextObject     drawContext,
  257.                                  CWindowPtr *            window);
  258.  
  259. EXTERN_API_C( TQ3Status )
  260. Q3MacDrawContext_SetGXViewPort    (TQ3DrawContextObject     drawContext,
  261.                                  gxViewPort             viewPort);
  262.  
  263. EXTERN_API_C( TQ3Status )
  264. Q3MacDrawContext_GetGXViewPort    (TQ3DrawContextObject     drawContext,
  265.                                  gxViewPort *            viewPort);
  266.  
  267. EXTERN_API_C( TQ3Status )
  268. Q3MacDrawContext_SetGrafPort    (TQ3DrawContextObject     drawContext,
  269.                                  CGrafPtr                 grafPort);
  270.  
  271. EXTERN_API_C( TQ3Status )
  272. Q3MacDrawContext_GetGrafPort    (TQ3DrawContextObject     drawContext,
  273.                                  CGrafPtr *                grafPort);
  274.  
  275. EXTERN_API_C( TQ3Status )
  276. Q3MacDrawContext_Set2DLibrary    (TQ3DrawContextObject     drawContext,
  277.                                  TQ3MacDrawContext2DLibrary  library);
  278.  
  279. EXTERN_API_C( TQ3Status )
  280. Q3MacDrawContext_Get2DLibrary    (TQ3DrawContextObject     drawContext,
  281.                                  TQ3MacDrawContext2DLibrary * library);
  282.  
  283. #endif  /* TARGET_OS_MAC */
  284.  
  285. #if TARGET_OS_UNIX
  286. /******************************************************************************
  287.  **                                                                             **
  288.  **                        X/Windows DrawContext Data Structures                 **
  289.  **                                                                             **
  290.  *****************************************************************************/
  291. typedef struct OpaqueTQ3XBufferObject*     TQ3XBufferObject;
  292.  
  293. struct TQ3XColormapData {
  294.     long                             baseEntry;
  295.     long                             maxRed;
  296.     long                             maxGreen;
  297.     long                             maxBlue;
  298.     long                             multRed;
  299.     long                             multGreen;
  300.     long                             multBlue;
  301. };
  302. typedef struct TQ3XColormapData            TQ3XColormapData;
  303.  
  304. struct TQ3XDrawContextData {
  305.     TQ3DrawContextData                 contextData;
  306.     Display *                        display;
  307.     Drawable                         drawable;
  308.     Visual *                        visual;
  309.     Colormap                         cmap;
  310.     TQ3XColormapData *                colorMapData;
  311. };
  312. typedef struct TQ3XDrawContextData        TQ3XDrawContextData;
  313. /******************************************************************************
  314.  **                                                                             **
  315.  **                        X/Windows DrawContext Routines                         **
  316.  **                                                                             **
  317.  *****************************************************************************/
  318. #ifdef XDC_OLD
  319. EXTERN_API_C( TQ3DrawContextObject )
  320. Q3XDrawContext_New                (void);
  321.  
  322. EXTERN_API_C( void )
  323. Q3XDrawContext_Set                (TQ3DrawContextObject     drawContext,
  324.                                  unsigned long             flag,
  325.                                  void *                    data);
  326.  
  327. EXTERN_API_C( void )
  328. Q3XDrawContext_Get                (TQ3DrawContextObject     drawContext,
  329.                                  unsigned long             flag,
  330.                                  void *                    data);
  331.  
  332. #endif  /*  defined(XDC_OLD)  */
  333.  
  334. EXTERN_API_C( TQ3XBufferObject )
  335. Q3XBuffers_New                    (Display *                dpy,
  336.                                  unsigned long             numBuffers,
  337.                                  Window                 window);
  338.  
  339. EXTERN_API_C( void )
  340. Q3XBuffers_Swap                    (Display *                dpy,
  341.                                  TQ3XBufferObject         buffers);
  342.  
  343. EXTERN_API_C( XVisualInfo *)
  344. Q3X_GetVisualInfo                (Display *                dpy,
  345.                                  Screen *                screen);
  346.  
  347.  
  348. EXTERN_API_C( TQ3DrawContextObject )
  349. Q3XDrawContext_New                (const TQ3XDrawContextData * xContextData);
  350.  
  351. EXTERN_API_C( TQ3Status )
  352. Q3XDrawContext_SetDisplay        (TQ3DrawContextObject     drawContext,
  353.                                  const Display *        display);
  354.  
  355. EXTERN_API_C( TQ3Status )
  356. Q3XDrawContext_GetDisplay        (TQ3DrawContextObject     drawContext,
  357.                                  Display **                display);
  358.  
  359. EXTERN_API_C( TQ3Status )
  360. Q3XDrawContext_SetDrawable        (TQ3DrawContextObject     drawContext,
  361.                                  Drawable                 drawable);
  362.  
  363. EXTERN_API_C( TQ3Status )
  364. Q3XDrawContext_GetDrawable        (TQ3DrawContextObject     drawContext,
  365.                                  Drawable *                drawable);
  366.  
  367. EXTERN_API_C( TQ3Status )
  368. Q3XDrawContext_SetVisual        (TQ3DrawContextObject     drawContext,
  369.                                  const Visual *            visual);
  370.  
  371. EXTERN_API_C( TQ3Status )
  372. Q3XDrawContext_GetVisual        (TQ3DrawContextObject     drawContext,
  373.                                  Visual **                visual);
  374.  
  375. EXTERN_API_C( TQ3Status )
  376. Q3XDrawContext_SetColormap        (TQ3DrawContextObject     drawContext,
  377.                                  Colormap                 colormap);
  378.  
  379. EXTERN_API_C( TQ3Status )
  380. Q3XDrawContext_GetColormap        (TQ3DrawContextObject     drawContext,
  381.                                  Colormap *                colormap);
  382.  
  383. EXTERN_API_C( TQ3Status )
  384. Q3XDrawContext_SetColormapData    (TQ3DrawContextObject     drawContext,
  385.                                  const TQ3XColormapData * colormapData);
  386.  
  387. EXTERN_API_C( TQ3Status )
  388. Q3XDrawContext_GetColormapData    (TQ3DrawContextObject     drawContext,
  389.                                  TQ3XColormapData *        colormapData);
  390.  
  391. #endif  /* TARGET_OS_UNIX */
  392.  
  393. #if TARGET_OS_WIN32
  394. /******************************************************************************
  395.  **                                                                             **
  396.  **                         Win32 DrawContext Data Structures                      **
  397.  **                                                                             **
  398.  *****************************************************************************/
  399.  
  400. struct TQ3Win32DCDrawContextData {
  401.     TQ3DrawContextData                 drawContextData;
  402.     HDC                             hdc;
  403. };
  404. typedef struct TQ3Win32DCDrawContextData TQ3Win32DCDrawContextData;
  405. #if !defined(QD3D_NO_DIRECTDRAW)
  406.  
  407. enum TQ3DirectDrawObjectSelector {
  408.     kQ3DirectDrawObject            = 1,
  409.     kQ3DirectDrawObject2        = 2
  410. };
  411. typedef enum TQ3DirectDrawObjectSelector TQ3DirectDrawObjectSelector;
  412.  
  413.  
  414. enum TQ3DirectDrawSurfaceSelector {
  415.     kQ3DirectDrawSurface        = 1,
  416.     kQ3DirectDrawSurface2        = 2
  417. };
  418. typedef enum TQ3DirectDrawSurfaceSelector TQ3DirectDrawSurfaceSelector;
  419.  
  420.  
  421. struct TQ3DDSurfaceDescriptor {
  422.     TQ3DirectDrawObjectSelector        objectSelector;
  423.     union
  424.     {
  425.         LPDIRECTDRAW                lpDirectDraw;
  426.         LPDIRECTDRAW2                lpDirectDraw2;
  427.     };
  428.  
  429.     TQ3DirectDrawSurfaceSelector    surfaceSelector;
  430.     union
  431.     {
  432.         LPDIRECTDRAWSURFACE            lpDirectDrawSurface;
  433.         LPDIRECTDRAWSURFACE2        lpDirectDrawSurface2;
  434.     };
  435. };
  436. typedef struct TQ3DDSurfaceDescriptor TQ3DDSurfaceDescriptor;
  437.  
  438. struct TQ3DDSurfaceDrawContextData {
  439.     TQ3DrawContextData                drawContextData;
  440.     TQ3DDSurfaceDescriptor            ddSurfaceDescriptor;
  441. };
  442. typedef struct TQ3DDSurfaceDrawContextData TQ3DDSurfaceDrawContextData;
  443.  
  444. #endif  /*  ! defined(QD3D_NO_DIRECTDRAW)  */
  445.  
  446. /******************************************************************************
  447.  **                                                                             **
  448.  **                            Win32DC DrawContext Routines                     **
  449.  **                                                                             **
  450.  *****************************************************************************/
  451. EXTERN_API_C( TQ3DrawContextObject )
  452. Q3Win32DCDrawContext_New        (const TQ3Win32DCDrawContextData * drawContextData);
  453.  
  454. EXTERN_API_C( TQ3Status )
  455. Q3Win32DCDrawContext_SetDC        (TQ3DrawContextObject     drawContext,
  456.                                  HDC                     newHDC);
  457.  
  458. EXTERN_API_C( TQ3Status )
  459. Q3Win32DCDrawContext_GetDC        (TQ3DrawContextObject     drawContext,
  460.                                  HDC *                    curHDC);
  461.  
  462. /******************************************************************************
  463.  **                                                                             **
  464.  **                            DDSurface DrawContext Routines                     **
  465.  **                                                                             **
  466.  *****************************************************************************/
  467. #if !defined(QD3D_NO_DIRECTDRAW)
  468. EXTERN_API_C( TQ3DrawContextObject )
  469. Q3DDSurfaceDrawContext_New        (const TQ3DDSurfaceDrawContextData * drawContextData);
  470.  
  471. EXTERN_API_C( TQ3Status )
  472. Q3DDSurfaceDrawContext_SetDirectDrawSurface (TQ3DrawContextObject  drawContext,
  473.                                  const TQ3DDSurfaceDescriptor * ddSurfaceDescriptor);
  474.  
  475. EXTERN_API_C( TQ3Status )
  476. Q3DDSurfaceDrawContext_GetDirectDrawSurface (TQ3DrawContextObject  drawContext,
  477.                                  TQ3DDSurfaceDescriptor * ddSurfaceDescriptor);
  478.  
  479. #endif  /*  ! defined(QD3D_NO_DIRECTDRAW)  */
  480.  
  481. #endif  /* TARGET_OS_WIN32 */
  482.  
  483.  
  484.  
  485.  
  486.  
  487. #if PRAGMA_ENUM_ALWAYSINT
  488.     #pragma enumsalwaysint reset
  489. #elif PRAGMA_ENUM_OPTIONS
  490.     #pragma option enum=reset
  491. #elif defined(PRAGMA_ENUM_PACK__QD3DDRAWCONTEXT__)
  492.     #pragma options(pack_enums)
  493. #endif
  494.  
  495. #if PRAGMA_STRUCT_ALIGN
  496.     #pragma options align=reset
  497. #elif PRAGMA_STRUCT_PACKPUSH
  498.     #pragma pack(pop)
  499. #elif PRAGMA_STRUCT_PACK
  500.     #pragma pack()
  501. #endif
  502.  
  503. #ifdef PRAGMA_IMPORT_OFF
  504. #pragma import off
  505. #elif PRAGMA_IMPORT
  506. #pragma import reset
  507. #endif
  508.  
  509. #ifdef __cplusplus
  510. }
  511. #endif
  512.  
  513. #endif /* __QD3DDRAWCONTEXT__ */
  514.  
  515.